using System;
using System.Collections;
using System.Collections.Generic;
using LL.Data.Mapping;

namespace NanoERP.Model
{
    /// <summary>
    /// 往来单位信息
    /// </summary>
    [Serializable]
    public sealed class Clientinfo
    {
        #region Private Members

        // Variabili di stato
        private bool _isChanged;

        // Primary Key(s) 
        private long _id;

        // Properties 
        private string _clientname;
        private int? _ctype;
        private string _telephone;
        private long? _clienttype;
        private string _clientlogistics;
        private string _clientpym;
        private long? _salesman;
        private string _clientno;
        private long? _deptid;
        private string _linkman;
        private string _mobilephone;
        private string _fax;
        private string _address;
        private string _region;
        private long? _regionid;
        private string _postcode;
        private string _email;
        private string _exfield1;
        private string _exfield2;
        private string _exfield3;
        private string _exfield4;
        private string _preprice;
        private string _prediscount;
        private decimal? _recmoney;
        private decimal? _paymoney;
        private decimal? _recmoneysum;
        private decimal? _paymoneysum;
        private decimal? _recmoneycredit;
        private decimal? _paymoneycredit;
        private int? _recday;
        private int? _payday;
        private string _artificialperson;
        private string _registermoney;
        private string _bank;
        private string _accountno;
        private string _economytype;
        private string _taxno;
        private string _clientsource;
        private string _trade;
        private string _sendtype;
        private string _worktype;
        private string _creditlevel;
        private string _clientstate;
        private string _busiarea;
        private string _clientmemo;
        private string _note;
        private int? _isvalid;
        private DateTime? _linkdate;
        private DateTime? _createdate;
        private long? _createuserid;
        private int? _tag;

        #endregion

        #region Default ( Empty ) Class Constructor

        /// <summary>
        /// default constructor
        /// </summary>
        public Clientinfo()
        {
            _id = 0;
            _clientname = null;
            _ctype = null;
            _telephone = null;
            _clienttype = null;
            _clientlogistics = null;
            _clientpym = null;
            _salesman = null;
            _clientno = null;
            _deptid = null;
            _linkman = null;
            _mobilephone = null;
            _fax = null;
            _address = null;
            _region = null;
            _regionid = null;
            _postcode = null;
            _email = null;
            _exfield1 = null;
            _exfield2 = null;
            _exfield3 = null;
            _exfield4 = null;
            _preprice = null;
            _prediscount = null;
            _recmoney = null;
            _paymoney = null;
            _recmoneysum = null;
            _paymoneysum = null;
            _recmoneycredit = null;
            _paymoneycredit = null;
            _recday = null;
            _payday = null;
            _artificialperson = null;
            _registermoney = null;
            _bank = null;
            _accountno = null;
            _economytype = null;
            _taxno = null;
            _clientsource = null;
            _trade = null;
            _sendtype = null;
            _worktype = null;
            _creditlevel = null;
            _clientstate = null;
            _busiarea = null;
            _clientmemo = null;
            _note = null;
            _isvalid = 0;
            _linkdate = DateTime.Now;
            _createdate = DateTime.Now;
            _createuserid = null;
            _tag = null;
        }

        #endregion // End of Default ( Empty ) Class Constructor

        #region Full Constructor

        /// <summary>
        /// full constructor
        /// </summary>
        public Clientinfo(long id, string clientname, int? ctype, string telephone, long? clienttype, string clientlogistics, string clientpym, long? salesman, string clientno, long? deptid, string linkman, string mobilephone, string fax, string region, long? regionid, string postcode, string email, string exfield1, string exfield2, string exfield3, string exfield4, string preprice, string prediscount, decimal? recmoney, decimal? paymoney, decimal? recmoneysum, decimal? paymoneysum, decimal? recmoneycredit, decimal? paymoneycredit, int? recday, int? payday, string artificialperson, string registermoney, string bank, string accountno, string economytype, string taxno, string clientsource, string trade, string sendtype, string worktype, string creditlevel, string clientstate, string busiarea, string clientmemo, string note, int? isvalid, DateTime? linkdate, DateTime? createdate, long? createuserid, int? tag)
        {
            _id = id;
            _clientname = clientname;
            _ctype = ctype;
            _telephone = telephone;
            _clienttype = clienttype;
            _clientlogistics = clientlogistics;
            _clientpym = clientpym;
            _salesman = salesman;
            _clientno = clientno;
            _deptid = deptid;
            _linkman = linkman;
            _mobilephone = mobilephone;
            _fax = fax;
            _region = region;
            _regionid = regionid;
            _postcode = postcode;
            _email = email;
            _exfield1 = exfield1;
            _exfield2 = exfield2;
            _exfield3 = exfield3;
            _exfield4 = exfield4;
            _preprice = preprice;
            _prediscount = prediscount;
            _recmoney = recmoney;
            _paymoney = paymoney;
            _recmoneysum = recmoneysum;
            _paymoneysum = paymoneysum;
            _recmoneycredit = recmoneycredit;
            _paymoneycredit = paymoneycredit;
            _recday = recday;
            _payday = payday;
            _artificialperson = artificialperson;
            _registermoney = registermoney;
            _bank = bank;
            _accountno = accountno;
            _economytype = economytype;
            _taxno = taxno;
            _clientsource = clientsource;
            _trade = trade;
            _sendtype = sendtype;
            _worktype = worktype;
            _creditlevel = creditlevel;
            _clientstate = clientstate;
            _busiarea = busiarea;
            _clientmemo = clientmemo;
            _note = note;
            _isvalid = isvalid;
            _linkdate = linkdate;
            _createdate = createdate;
            _createuserid = createuserid;
            _tag = tag;
        }

        #endregion // End Full Constructor

        #region Public Properties

        /// <summary>
        /// 主键
        /// </summary>	
        public long Id
        {
            get { return _id; }
            set { _isChanged |= (_id != value); _id = value; }
        }

        /// <summary>
        /// 单位名称
        /// </summary>		
        public string Clientname
        {
            get { return _clientname; }
            set
            {
                if (value != null)
                    if (value.Length > 300)
                        throw new ArgumentOutOfRangeException("Invalid value for Clientname", value, value.ToString());

                _isChanged |= (_clientname != value); _clientname = value;
            }
        }

        /// <summary>
        /// 单位性质 1供应商  2客户 3 快递公司
        /// </summary>		
        public int? Ctype
        {
            get { return _ctype; }
            set { _isChanged |= (_ctype != value); _ctype = value; }
        }

        /// <summary>
        /// 联系电话
        /// </summary>		
        public string Telephone
        {
            get { return _telephone; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Telephone", value, value.ToString());

                _isChanged |= (_telephone != value); _telephone = value;
            }
        }

        /// <summary>
        /// 单位类别
        /// </summary>		
        public long? Clienttype
        {
            get { return _clienttype; }
            set { _isChanged |= (_clienttype != value); _clienttype = value; }
        }

        /// <summary>
        /// 送货物流
        /// </summary>		
        public string Clientlogistics
        {
            get { return _clientlogistics; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Clientlogistics", value, value.ToString());

                _isChanged |= (_clientlogistics != value); _clientlogistics = value;
            }
        }

        /// <summary>
        /// 接音码
        /// </summary>		
        public string Clientpym
        {
            get { return _clientpym; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Clientpym", value, value.ToString());

                _isChanged |= (_clientpym != value); _clientpym = value;
            }
        }

        /// <summary>
        /// 所属销售员
        /// </summary>		
        public long? Salesman
        {
            get { return _salesman; }
            set { _isChanged |= (_salesman != value); _salesman = value; }
        }

        /// <summary>
        /// 所属销售员名
        /// </summary>
        [IgnoreAttribute()] 
        public string SalesmanName { get; set; }

        /// <summary>
        /// 单位编码
        /// </summary>		
        public string Clientno
        {
            get { return _clientno; }
            set
            {
                if (value != null)
                    if (value.Length > 300)
                        throw new ArgumentOutOfRangeException("Invalid value for Clientno", value, value.ToString());

                _isChanged |= (_clientno != value); _clientno = value;
            }
        }

        /// <summary>
        /// 所属部门 表:DEPTINFO
        /// </summary>		
        public long? Deptid
        {
            get { return _deptid; }
            set { _isChanged |= (_deptid != value); _deptid = value; }
        }

        /// <summary>
        /// 所属部门名称
        /// </summary>
        [IgnoreAttribute()] 
        public string DeptName { get; set; }

        /// <summary>
        /// 联系人
        /// </summary>		
        public string Linkman
        {
            get { return _linkman; }
            set
            {
                if (value != null)
                    if (value.Length > 200)
                        throw new ArgumentOutOfRangeException("Invalid value for Linkman", value, value.ToString());

                _isChanged |= (_linkman != value); _linkman = value;
            }
        }

        /// <summary>
        /// 手机
        /// </summary>		
        public string Mobilephone
        {
            get { return _mobilephone; }
            set
            {
                if (value != null)
                    if (value.Length > 200)
                        throw new ArgumentOutOfRangeException("Invalid value for Mobilephone", value, value.ToString());

                _isChanged |= (_mobilephone != value); _mobilephone = value;
            }
        }

        /// <summary>
        /// 传真
        /// </summary>		
        public string Fax
        {
            get { return _fax; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Fax", value, value.ToString());

                _isChanged |= (_fax != value); _fax = value;
            }
        }

        /// <summary>
        /// 地址
        /// </summary>		
        public string Address
        {
            get { return _address; }
            set
            {
                if (value != null)
                    if (value.Length > 500)
                        throw new ArgumentOutOfRangeException("Invalid value for Address", value, value.ToString());

                _isChanged |= (_address != value); _address = value;
            }
        }

        /// <summary>
        /// 所属地区   表：refcode
        /// </summary>		
        public string Region
        {
            get { return _region; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Region", value, value.ToString());

                _isChanged |= (_region != value); _region = value;
            }
        }

        /// <summary>
        /// 所属地区编号
        /// </summary>		
        public long? Regionid
        {
            get { return _regionid; }
            set { _isChanged |= (_regionid != value); _regionid = value; }
        }

        /// <summary>
        /// 邮政编码
        /// </summary>		
        public string Postcode
        {
            get { return _postcode; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Postcode", value, value.ToString());

                _isChanged |= (_postcode != value); _postcode = value;
            }
        }

        /// <summary>
        /// 电子邮箱
        /// </summary>		
        public string Email
        {
            get { return _email; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Email", value, value.ToString());

                _isChanged |= (_email != value); _email = value;
            }
        }

        /// <summary>
        /// EXFIELD1
        /// </summary>		
        public string Exfield1
        {
            get { return _exfield1; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield1", value, value.ToString());

                _isChanged |= (_exfield1 != value); _exfield1 = value;
            }
        }

        /// <summary>
        /// EXFIELD2
        /// </summary>		
        public string Exfield2
        {
            get { return _exfield2; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield2", value, value.ToString());

                _isChanged |= (_exfield2 != value); _exfield2 = value;
            }
        }

        /// <summary>
        /// EXFIELD3
        /// </summary>		
        public string Exfield3
        {
            get { return _exfield3; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield3", value, value.ToString());

                _isChanged |= (_exfield3 != value); _exfield3 = value;
            }
        }

        /// <summary>
        /// EXFIELD4
        /// </summary>		
        public string Exfield4
        {
            get { return _exfield4; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield4", value, value.ToString());

                _isChanged |= (_exfield4 != value); _exfield4 = value;
            }
        }

        /// <summary>
        /// 预设售价
        /// </summary>		
        public string Preprice
        {
            get { return _preprice; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Preprice", value, value.ToString());

                _isChanged |= (_preprice != value); _preprice = value;
            }
        }

        /// <summary>
        /// 预设折扣
        /// </summary>		
        public string Prediscount
        {
            get { return _prediscount; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Prediscount", value, value.ToString());

                _isChanged |= (_prediscount != value); _prediscount = value;
            }
        }

        /// <summary>
        /// 期初应收款
        /// </summary>		
        public decimal? Recmoney
        {
            get { return _recmoney; }
            set { _isChanged |= (_recmoney != value); _recmoney = value; }
        }

        /// <summary>
        /// 期初应付款
        /// </summary>		
        public decimal? Paymoney
        {
            get { return _paymoney; }
            set { _isChanged |= (_paymoney != value); _paymoney = value; }
        }

        /// <summary>
        /// 累计应收款
        /// </summary>		
        public decimal? Recmoneysum
        {
            get { return _recmoneysum; }
            set { _isChanged |= (_recmoneysum != value); _recmoneysum = value; }
        }

        /// <summary>
        /// 累计应付款
        /// </summary>		
        public decimal? Paymoneysum
        {
            get { return _paymoneysum; }
            set { _isChanged |= (_paymoneysum != value); _paymoneysum = value; }
        }

        /// <summary>
        /// 应收信用额
        /// </summary>		
        public decimal? Recmoneycredit
        {
            get { return _recmoneycredit; }
            set { _isChanged |= (_recmoneycredit != value); _recmoneycredit = value; }
        }

        /// <summary>
        /// 应付信用额
        /// </summary>		
        public decimal? Paymoneycredit
        {
            get { return _paymoneycredit; }
            set { _isChanged |= (_paymoneycredit != value); _paymoneycredit = value; }
        }

        /// <summary>
        /// 收款期限
        /// </summary>		
        public int? Recday
        {
            get { return _recday; }
            set { _isChanged |= (_recday != value); _recday = value; }
        }

        /// <summary>
        /// 付款期限
        /// </summary>		
        public int? Payday
        {
            get { return _payday; }
            set { _isChanged |= (_payday != value); _payday = value; }
        }

        /// <summary>
        /// 法人代表
        /// </summary>		
        public string Artificialperson
        {
            get { return _artificialperson; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Artificialperson", value, value.ToString());

                _isChanged |= (_artificialperson != value); _artificialperson = value;
            }
        }

        /// <summary>
        /// 注册资金
        /// </summary>		
        public string Registermoney
        {
            get { return _registermoney; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Registermoney", value, value.ToString());

                _isChanged |= (_registermoney != value); _registermoney = value;
            }
        }

        /// <summary>
        /// 开户银行
        /// </summary>		
        public string Bank
        {
            get { return _bank; }
            set
            {
                if (value != null)
                    if (value.Length > 200)
                        throw new ArgumentOutOfRangeException("Invalid value for Bank", value, value.ToString());

                _isChanged |= (_bank != value); _bank = value;
            }
        }

        /// <summary>
        /// 开帐帐号
        /// </summary>		
        public string Accountno
        {
            get { return _accountno; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Accountno", value, value.ToString());

                _isChanged |= (_accountno != value); _accountno = value;
            }
        }

        /// <summary>
        /// 经济类型
        /// </summary>		
        public string Economytype
        {
            get { return _economytype; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Economytype", value, value.ToString());

                _isChanged |= (_economytype != value); _economytype = value;
            }
        }

        /// <summary>
        /// 税号
        /// </summary>		
        public string Taxno
        {
            get { return _taxno; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Taxno", value, value.ToString());

                _isChanged |= (_taxno != value); _taxno = value;
            }
        }

        /// <summary>
        /// 客户来源
        /// </summary>		
        public string Clientsource
        {
            get { return _clientsource; }
            set
            {
                if (value != null)
                    if (value.Length > 500)
                        throw new ArgumentOutOfRangeException("Invalid value for Clientsource", value, value.ToString());

                _isChanged |= (_clientsource != value); _clientsource = value;
            }
        }

        /// <summary>
        /// 所属行业
        /// </summary>		
        public string Trade
        {
            get { return _trade; }
            set
            {
                if (value != null)
                    if (value.Length > 500)
                        throw new ArgumentOutOfRangeException("Invalid value for Trade", value, value.ToString());

                _isChanged |= (_trade != value); _trade = value;
            }
        }

        /// <summary>
        /// 发货方式
        /// </summary>		
        public string Sendtype
        {
            get { return _sendtype; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Sendtype", value, value.ToString());

                _isChanged |= (_sendtype != value); _sendtype = value;
            }
        }

        /// <summary>
        /// 经营类型
        /// </summary>		
        public string Worktype
        {
            get { return _worktype; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Worktype", value, value.ToString());

                _isChanged |= (_worktype != value); _worktype = value;
            }
        }

        /// <summary>
        /// 客户级别
        /// </summary>		
        public string Creditlevel
        {
            get { return _creditlevel; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Creditlevel", value, value.ToString());

                _isChanged |= (_creditlevel != value); _creditlevel = value;
            }
        }

        /// <summary>
        /// 客户状态
        /// </summary>		
        public string Clientstate
        {
            get { return _clientstate; }
            set
            {
                if (value != null)
                    if (value.Length > 500)
                        throw new ArgumentOutOfRangeException("Invalid value for Clientstate", value, value.ToString());

                _isChanged |= (_clientstate != value); _clientstate = value;
            }
        }

        /// <summary>
        /// 业务范围
        /// </summary>		
        public string Busiarea
        {
            get { return _busiarea; }
            set
            {
                if (value != null)
                    if (value.Length > 1000)
                        throw new ArgumentOutOfRangeException("Invalid value for Busiarea", value, value.ToString());

                _isChanged |= (_busiarea != value); _busiarea = value;
            }
        }

        /// <summary>
        /// 客户概况
        /// </summary>		
        public string Clientmemo
        {
            get { return _clientmemo; }
            set
            {
                if (value != null)
                    if (value.Length > 2000)
                        throw new ArgumentOutOfRangeException("Invalid value for Clientmemo", value, value.ToString());

                _isChanged |= (_clientmemo != value); _clientmemo = value;
            }
        }

        /// <summary>
        /// 备注
        /// </summary>		
        public string Note
        {
            get { return _note; }
            set
            {
                if (value != null)
                    if (value.Length > 2000)
                        throw new ArgumentOutOfRangeException("Invalid value for Note", value, value.ToString());

                _isChanged |= (_note != value); _note = value;
            }
        }

        /// <summary>
        /// 是否无效 0有效，1-无效
        /// </summary>		
        public int? Isvalid
        {
            get { return _isvalid; }
            set { _isChanged |= (_isvalid != value); _isvalid = value; }
        }

        /// <summary>
        /// 联系时间
        /// </summary>		
        public DateTime? Linkdate
        {
            get { return _linkdate; }
            set { _isChanged |= (_linkdate != value); _linkdate = value; }
        }

        /// <summary>
        /// 创建日期
        /// </summary>		
        public DateTime? Createdate
        {
            get { return _createdate; }
            set { _isChanged |= (_createdate != value); _createdate = value; }
        }

        /// <summary>
        /// 创建人编号
        /// </summary>		
        public long? Createuserid
        {
            get { return _createuserid; }
            set { _isChanged |= (_createuserid != value); _createuserid = value; }
        }

        /// <summary>
        /// 显示顺序
        /// </summary>		
        public int? Tag
        {
            get { return _tag; }
            set { _isChanged |= (_tag != value); _tag = value; }
        }

        #endregion

    }
}